﻿using UnityEngine;
using System.Collections;
using Login;

public class InputNickName : MonoBehaviour {
    public GameObject okButton;
    public GameObject nickNameInput;
    private string nickName;
    public GameObject errInfo;
    public LoginUI loginUI;
    /// <summary>
    /// 确定
    /// </summary>
    public void OnOkButtonClick() 
    {
        nickName = nickNameInput.GetComponent<UIInput>().label.GetComponent<UILabel>().text;
        if (nickName != "")
        {
            loginUI.manager.nickNameStr= nickName;
            loginUI.manager.SwitchState(LoginState.PlayerCreate);
        }
        else
        {
            errInfo.SetActive(true);
        }
       
        
    }
    /// <summary>
    /// 随机生成一个名字
    /// </summary>
    public void OnRandomClick() 
    {
        loginUI.manager.SwitchState(LoginState.GenerateName);
    }


    public void Close() 
    {
        this.gameObject.SetActive(false);
    }
}
